wget https://www.python.org/ftp/python/3.12.1/Python-3.12.1.tgz
tar -zxvf Python-3.12.1.tgz
cd Python-3.12.1/
dnf install -y make gcc gcc-c++ zlib zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel

./configure --prefix=/usr/local/python3.12.1 --enable-shared --with-system-expat --enable-optimizations && make && make install

ln -sf /usr/local/python3.12.1/bin/python3 /usr/bin/python
ln -sf /usr/local/python3.12.1/bin/python3 /usr/bin/python3
ln -sf /usr/local/python3.12.1/bin/pip3 /usr/bin/pip
ln -sf /usr/local/python3.12.1/bin/pip3 /usr/bin/pip3

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
